<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>税单查询</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'/>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <%@include file="/WEB-INF/pages/common/taglib.jsp" %>
    <%@include file="/WEB-INF/pages/common/common.jsp" %>
</head>
<body>
<div class="content content_frame">
    <h3 class="mainTitle"><img src="${basePath}/images/icon2.png"/>税单查询</h3>
    </br>
    <ul class="contentNav dib-wrap">
        <li class="dib" id="btnSearch" defaultkey='13'>
            <a><i class='fa fa-search'></i>&nbsp;&nbsp;查&nbsp;询</a>
        </li>
        <li class="dib" id="btnPrint" defaultkey='13'>
            <a><i class='fa fa-print'></i>&nbsp;&nbsp;打&nbsp;印</a>
        </li>
        <li class="dib ">
            <a onclick="ClearAllInput('SearchTable')">
                <i class='fa fa-refresh'></i>&nbsp;&nbsp;重&nbsp;置</a>
        </li>
    </ul>
    <br/>
    <table id="SearchTable" width="100%" class="table1">
        <tr>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            汇总税单号
                        </td>
                        <td class="tdCss">
                            <input type="text" placeholder="汇总税单号" datafield="SearchTable.fcNo">
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            缴款单位名称
                        </td>
                        <td class="tdCss">
                            <input type="text" placeholder="缴款单位名称" datafield="SearchTable.fcPayEnpName">
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            是否打印
                        </td>
                        <td class="tdCss">
                            <select datafield="SearchTable.fiIfprint" style="width: 100%">
                                <option value="">全部</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            是否跨境
                        </td>
                        <td class="tdCss">
                            <select datafield="SearchTable.isCross" style="width: 100%">
                                <option value="">全部</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            汇总时间
                        </td>
                        <td class="tdCss">
                            <input type='text' class="Wdate"
                                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'fdMergeTmEnd\')}'})"
                                   timeformat="YYYY-MM-DD HH:MM:SS" id="fdMergeTmStart"
                                   datafield="SearchTable.fdMergeTmStart"/>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            至
                        </td>
                        <td class="tdCss">
                            <input type='text' style="width: 100%;" class="Wdate"
                                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'fdMergeTmStart\')}'})"
                                   timeformat="YYYY-MM-DD HH:MM:SS" id="fdMergeTmEnd"
                                   datafield="SearchTable.fdMergeTmEnd"/>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            创建人
                        </td>
                        <td class="tdCss">
                            <input type="text" placeholder="创建人" datafield="SearchTable.fcCreator"/>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            申请单位编号
                        </td>
                        <td class="tdCss">
                            <input type="text" placeholder="申请单位编号" datafield="SearchTable.fcPayEnpCode"/>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <div class="cl"></div>
    <br/>
    <table id="corptable">
    </table>
    <div id="corptablePage">
    </div>
</div>
<script type="text/javascript">
    function urlCode(cellvalue, options, rowObject) {
        var url = '${basePath}/commonDetail/taxbillQdcDetail/' + rowObject.indx;
        return "<a class='btn-link' href=\"" + url + "\">" + "<span style='color:#00acec'>" + rowObject.fcNo + "</span></a>";
    }

    $(function () {
        $("#corptable").jqGrid({
            datatype: "json",
            url: "${basePath}/importB2CTax/taxbillQdc/queryTbMergeTaxList",
            colNames: [
                'indx',
                '汇总税单号',
                '创建日期',
                '创建人',
                '缴款单位名称',
                '申请单位编号',
                '是否打印',
                '是否跨境'
            ],
            colModel: [
                {name: 'indx', index: 'indx', hidden: true},
                {name: 'fcNo', index: 'fcNo', formatter: urlCode},
                {name: 'fdMergeTm', index: 'fdMergeTm'},
                {name: 'fcCreator', index: 'fcCreator'},
                {name: 'fcPayEnpName', index: 'fcPayEnpName'},
                {name: 'fcPayEnpCode', index: 'fcPayEnpCode'},
                {name: 'fiIfprint', index: 'fiIfprint', formatter: isOrNo},
                {name: 'isCross', index: 'isCross', formatter: isOrNo}
            ],
            viewrecords: true,
            autowidth: true,
            height: 'auto',
            shrinkToFit: false,
            autoScroll: true,
            rowNum: 10, //每页显示记录数
            rowList: [10, 20, 100], //可调整每页显示的记录数
            rownumbers: true,
            rownumWidth: 15,
            multiselect: true,
            pager: "#corptablePage", //分页工具栏
            sortname: "fdMergeTm",
            sortorder: "desc",
            loadComplete: function () {
                var rowNum = $(this).jqGrid('getGridParam', 'records');
                if (rowNum <= 0) {
                    if ($(this).parent().children('.norecords').length == 0)
                        $(this).parent().append("<div class=\"norecords\">暂无数据！</div>");
                    $(this).parent().children('.norecords').show();
                }
                else {
                    $(this).parent().children('.norecords').hide();
                }

                $("#corptable").setGridWidth($(window).width() * 0.98);
                $(".ui-jqgrid tr.ui-row-ltr td").css('text-align', 'center');
            }
        });
    });

    function reloadGrid() {
        var jsonStr = customFormToData("SearchTable");
        $("#corptable").jqGrid('setGridParam', {
            url: "${basePath}/importB2CTax/taxbillQdc/queryTbMergeTaxList",
            postData: JSON.parse(jsonStr), //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    }

    $(function () {
        $("#btnSearch").bind("click", function () {
            reloadGrid();
        });

        $("#btnPrint").bind("click", function () {
            var jsonArr = getId("corptable");
            if (0 == jsonArr.length) {
                ShowMessages("请选择需要打印的记录", "系统提示", "msgwaring", null, 0);
            } else {
                ShowMessages("请检查打印机是否已连接", "系统提示", "msgwaring", null, 0);
            }
        });
    });
</script>
</body>
</html>
